<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>处理管理员登录页</title>
</head>
<body>

    <?php 
        //接收表单数据，链接数据库，查询admin表，进行信息比对，比对成功跳转welcome，失败返回登陆页

    require_once('../system/dbConn.php');
    connect();?>
        <?php
    $adminname=$_POST["adminname"];
    $password=$_POST["password"];
    $sql="select * from admins where adminname='$adminname' and password=md5('$password')";
    $result=mysql_query("$sql");
    $num=mysql_num_rows($result);
    if ($num>0) {
    	//将管理员的名字和adminid记录到session
        $row=mysql_fetch_assoc($result);
    	session_start();//启动会话
    	$_SESSION["adminname"]=$adminname;
        $_SESSION["adminid"]=$row["adminid"];//数据存入session
    	echo "login seccuss";
    	header("location:welcome.php");
    }
    else{
    	echo "页面3秒后跳转";
    	header("refresh:3,url='adminLogin.html'");
    }
    //echo "$result";
     ?>

</body>
</html>